\documentclass[english,compress]{beamer}
% {{{ preamble
\input{settings}

\logoenable

\pgfdeclarelayer{grid}
\pgfsetlayers{background,grid,main,foreground}
\def\intd{\, d}

\tikzset{%
  input/.style={circle,fill=input,draw,thick,minimum height=4.5ex},
  output/.style={circle,fill=output,draw,thick,minimum height=4.5ex},
  func/.style={->,thick},
}
\def\bigncentered#1{
  \begin{center}
    \Huge\bfseries #1
  \end{center}
}
\def\weblink#1#2{\href{#1}{\color{blue}\underline{#2}}}

\begin{document}

% -----------------------------------------------------------------------------
% {{{ front matter
% -----------------------------------------------------------------------------

\title[DSL to High Performance]{
  Domain-Specific
  Languages to High Performance: Code Generation and Transformation in
  Python\\
  Part 1: Introduction
}

\author{
  Andreas Klöckner\\
}

\institute[Computer Science $\cdot$ UIUC]
{Computer Science\\University of Illinois at Urbana-Champaign}

\date{}

\frame{
  \titlepage
}
% }}}
% -----------------------------------------------------------------------------
\section{Outline}
% -----------------------------------------------------------------------------
\begin{frame}{High Performance: What?}
  What is\dots {\huge High Performance Computing?}

  \bigskip
  The \emph{science} of making code \alt<2->{{\color{red}\sout{actually
  fast.}}}{actually fast.}

  \uncover<3->{{\color{green}achieve the \textbf{best} performance possible on a given machine.}}

  \uncover<4->{
    \begin{itemize}
      \item {\color{red}\textbf{NO:} I made my code 300,000x faster.}
      \item {\color{green}\textbf{YES:} My code achieves 37\% of the
      achievable floating point capability of my machine.}
    \end{itemize}
  }
  \uncover<5->{
    \textbf{Performance:} Measure $\to$ Understand $\to$ Improve $\to$
    Measure $\to$ Understand $\to$ Improve $\to \cdots$
  }

\end{frame}
% -----------------------------------------------------------------------------
\begin{frame}{Setting}
  High-performance code is \textbf{challenging}:
  \begin{itemize}
    \item designed to push machines, models, and methods to the limits
      of their capabilities

    %\item often put together on a (comparatively) shoestring budget

    \item often repurposed $\rightarrow$ high demands on
    flexibility
  \end{itemize}

\end{frame}
% -----------------------------------------------------------------------------
\begin{frame}{Goals}
  \textbf{Recipe:} Split `\textbf{math work}' from `\textbf{performance work}'

  \bigskip
  \begin{itemize}
    \item Build Mathematically-oriented mini-languages (`DSLs')
    \item Apply domain-specific optimizations and transformations
    \item Leverage tools to generate GPU/multi-core code from DSL
    \item Create glue that ties components together
  \end{itemize}
  \uncover<+->{}
  \uncover<+->{%
    \begin{tikzpicture} [overlay]
      \node [above left=1cm of current page.south east, draw,drop shadow,fill=white,
      inner xsep=0.5cm,inner ysep=0.5cm,thick, text
      width=0.7\textwidth]
        {%
          \textbf{Necessary consequence:}

          The computation itself is now \emph{data} that we will
          manipulate programmatically.
        } ;
    \end{tikzpicture}
  }
\end{frame}
% -----------------------------------------------------------------------------
\def\excl#1{{\color<2->{lightgray}#1}}
\begin{frame}
  \begin{columns}
    \column{0.5\textwidth}
    \begin{itemize}
    \setlength{\itemsep}{0.0in}
    \item Introduction
      \begin{itemize}
        %\item Why Python?
        \item IPython
        \item Python
        \item \texttt{numpy}
      \end{itemize}
    \item \excl{Building languages}
      \begin{itemize}
        \item \excl{Syntax trees}
        \item \excl{Expression languages}
        \item \excl{Operations on expression trees}
        \item \excl{A first glimpse of code generation}
      \end{itemize}
    \item OpenCL as a vehicle for code generation
      \begin{itemize}
        \item Execution model
        \item OpenCL + Python
        \item \excl{High-performance primitives}
      \end{itemize}
    \end{itemize}

    \column{0.5\textwidth}
    \begin{itemize}
    \item Case studies
      \begin{itemize}
        \item \excl{\texttt{numpy}: broadcasting}
        \item \texttt{numpy}: \texttt{einsum}
        \item \excl{UFL}
      \end{itemize}
    \item \excl{Generating C}
      \begin{itemize}
        \item \excl{Using templating engines}
        \item \excl{Types and hybrid code}
        \item \excl{Structured code generation (ASTs)}
      \end{itemize}
    \item Code generation via Loopy
      \begin{itemize}
        \item Loop polyhedra
        \item Instructions and ordering
        \item \excl{Loop transformation, and data layout}
        \item Generating instructions from DSLs
      \end{itemize}
    \end{itemize}
  \end{columns}
\end{frame}
% -----------------------------------------------------------------------------
\begin{comment}
\section{Why Python?}
% -----------------------------------------------------------------------------
\begin{frame}{Why Python?}
  \uncover<+->{
    Python: One example of a modern scripting language
  }
  \medskip

  \begin{columns}[c]
    \column{0.6\textwidth}
    \begin{itemize}
      \item Mature
      \item Large and active community
      \item Emphasizes readability
      \item Written in widely-portable C
      \item A `multi-paradigm' language
      \item Rich ecosystem of sci-comp related software
    \end{itemize}

    \column{0.3\textwidth}
    \includegraphics[width=\textwidth]{python-logo-no-shadow.png}
  \end{columns}
\end{frame}
\addimgcredit{Python logo: python.org}
% -----------------------------------------------------------------------------
\begin{frame}{Why Python for HPC?}
  Python is unique as an HPC language:
  \begin{itemize}
  \item approachable
  \item safe
  \item gentle learning curve
  \item principled
  \item performant enough for large, complicated systems
  \end{itemize}
\end{frame}
\end{comment}
% -----------------------------------------------------------------------------
\section{Software Overview}
% -----------------------------------------------------------------------------
\begin{frame}{Getting the software}
  Core packages:
  \begin{itemize}
    \item Python: \url{https://www.python.org}
    \item numpy: \url{https://www.numpy.org}
    \item pymbolic: \url{https://github.com/inducer/pymbolic}
    \item PyOpenCL: \url{https://github.com/pyopencl/pyopencl}
    \item loopy: \url{https://github.com/inducer/loopy}
  \end{itemize}
  % Supporting packages:
  % \begin{itemize}
  %   \item matplotlib: \url{http://www.matplotlib.org}
  %   \item mako: \url{http://www.makotemplates.org}
  %   \item cgen: \url{https://github.com/inducer/cgen}
  % \end{itemize}
  All open-source under MIT/BSD licenses.
\end{frame}
% -----------------------------------------------------------------------------
\begin{comment}
\begin{frame}{Installing the software}
  \begin{itemize}
    \item Demo: \texttt{virtualenv}
    \item Demo: \texttt{pip}
  \end{itemize}
\end{frame}
\end{comment}
% -----------------------------------------------------------------------------
\begin{frame}
  \bigncentered{DEMO TIME}
\end{frame}
% }}}

\end{document}
